package com.wn;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * @author yellow Docter
 * @date 2023 -07-26
 * @desc
 */
@Builder   //构建者模式
@Data
@NoArgsConstructor
@AllArgsConstructor
public class User implements Serializable {
    private String name;
    private Integer age;

    public static void main(String[] args) {

        //拿到 User的构建器 User.builder()
        // 可以通过构建者调用 属性方法
        // 通过 build(); 创建user对象

        //可以链式编程
        User hello = User.builder().name("hello").age(20).build();

//        StringBuilder builder = new StringBuilder();
//        StringBuilder aaa = builder.append(1).append("aaa");

        System.out.println("hello = " + hello);

    }

}
